.class public Lcom/opongo/android/custom/DealsActivity;
.super Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;
.source "DealsActivity.java"


# static fields
.field private static final TAG:Ljava/lang/String;


# instance fields
.field private receiverPush:Landroid/content/BroadcastReceiver;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 23
    const-class v0, Lcom/opongo/android/custom/DealsActivity;

    invoke-virtual {v0}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v0

    sput-object v0, Lcom/opongo/android/custom/DealsActivity;->TAG:Ljava/lang/String;

    .line 21
    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 21
    invoke-direct {p0}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;-><init>()V

    return-void
.end method

.method static synthetic access$0(Lcom/opongo/android/custom/DealsActivity;I)V
    .locals 0
    .parameter
    .parameter

    .prologue
    .line 21
    iput p1, p0, Lcom/opongo/android/custom/DealsActivity;->post_id:I

    return-void
.end method

.method static synthetic access$1()Ljava/lang/String;
    .locals 1

    .prologue
    .line 23
    sget-object v0, Lcom/opongo/android/custom/DealsActivity;->TAG:Ljava/lang/String;

    return-object v0
.end method

.method static synthetic access$2(Lcom/opongo/android/custom/DealsActivity;)I
    .locals 1
    .parameter

    .prologue
    .line 21
    iget v0, p0, Lcom/opongo/android/custom/DealsActivity;->post_id:I

    return v0
.end method

.method static synthetic access$3()Landroid/support/v4/view/PagerAdapter;
    .locals 1

    .prologue
    .line 21
    sget-object v0, Lcom/opongo/android/custom/DealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    return-object v0
.end method


# virtual methods
.method public onCreate(Landroid/os/Bundle;)V
    .locals 13
    .parameter "savedInstanceState"

    .prologue
    const/4 v12, 0x3

    const/4 v11, 0x2

    const/4 v10, 0x0

    const/4 v3, 0x1

    .line 27
    invoke-super {p0, p1}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onCreate(Landroid/os/Bundle;)V

    .line 29
    const v0, 0x7f030008

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/DealsActivity;->setContentView(I)V

    .line 31
    new-instance v0, Lcom/opongo/blogapp/manager/DatabaseManager;

    const-string v1, "recent_posts"

    .line 32
    const-string v2, "INSERT INTO recent_posts (id,title,date,content,categories,commentscount,imageurl,post_order,guid,opened,newpost,did_vote,post_author,post_price,post_rating) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);"

    invoke-direct {v0, p0, v1, v2}, Lcom/opongo/blogapp/manager/DatabaseManager;-><init>(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;)V

    .line 31
    iput-object v0, p0, Lcom/opongo/android/custom/DealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    .line 34
    const-string v4, "SELECT post.* FROM recent_posts AS post INNER JOIN post_blogtype AS bt ON (post.id = bt.post_id AND bt.blogtype_id = %d) ORDER BY %s %s"

    .line 38
    .local v4, query:Ljava/lang/String;
    new-array v5, v12, [Ljava/lang/String;

    const-string v0, "Aktuelles"

    aput-object v0, v5, v10

    const-string v0, "Meistkommentiert"

    aput-object v0, v5, v3

    const-string v0, "Meistgelesen"

    aput-object v0, v5, v11

    .line 39
    .local v5, titles:[Ljava/lang/String;
    new-array v6, v12, [Ljava/lang/String;

    const-string v0, "date"

    aput-object v0, v6, v10

    const-string v0, "commentscount"

    aput-object v0, v6, v3

    const-string v0, "bt.post_order"

    aput-object v0, v6, v11

    .line 40
    .local v6, order:[Ljava/lang/String;
    new-array v7, v12, [Ljava/lang/Boolean;

    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    aput-object v0, v7, v10

    invoke-static {v3}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    aput-object v0, v7, v3

    invoke-static {v10}, Ljava/lang/Boolean;->valueOf(Z)Ljava/lang/Boolean;

    move-result-object v0

    aput-object v0, v7, v11

    .line 42
    .local v7, DESC:[Ljava/lang/Boolean;
    new-instance v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    iget-object v3, p0, Lcom/opongo/android/custom/DealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    move-object v1, p0

    move-object v2, p0

    invoke-direct/range {v0 .. v7}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;-><init>(Landroid/app/Activity;Landroid/content/Context;Lcom/opongo/blogapp/manager/DatabaseManager;Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/String;[Ljava/lang/Boolean;)V

    sput-object v0, Lcom/opongo/android/custom/DealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    .line 44
    const v0, 0x7f080024

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/DealsActivity;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Landroid/support/v4/view/ViewPager;

    .line 45
    .local v9, pager:Landroid/support/v4/view/ViewPager;
    const v0, 0x7f080023

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/DealsActivity;->findViewById(I)Landroid/view/View;

    move-result-object v8

    check-cast v8, Lcom/viewpagerindicator/TitlePageIndicator;

    .line 46
    .local v8, indicator:Lcom/viewpagerindicator/TitlePageIndicator;
    sget-object v0, Lcom/opongo/android/custom/DealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    invoke-virtual {v9, v0}, Landroid/support/v4/view/ViewPager;->setAdapter(Landroid/support/v4/view/PagerAdapter;)V

    .line 47
    invoke-virtual {v8, v9}, Lcom/viewpagerindicator/TitlePageIndicator;->setViewPager(Landroid/support/v4/view/ViewPager;)V

    .line 49
    new-instance v0, Lcom/opongo/android/custom/DealsActivity$1;

    invoke-direct {v0, p0}, Lcom/opongo/android/custom/DealsActivity$1;-><init>(Lcom/opongo/android/custom/DealsActivity;)V

    iput-object v0, p0, Lcom/opongo/android/custom/DealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    .line 71
    iget-object v0, p0, Lcom/opongo/android/custom/DealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    new-instance v1, Landroid/content/IntentFilter;

    .line 72
    const-string v2, "com.opongo.post_open_by_push"

    invoke-direct {v1, v2}, Landroid/content/IntentFilter;-><init>(Ljava/lang/String;)V

    .line 71
    invoke-virtual {p0, v0, v1}, Lcom/opongo/android/custom/DealsActivity;->registerReceiver(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;

    .line 73
    return-void
.end method

.method public onDestroy()V
    .locals 1

    .prologue
    .line 77
    iget-object v0, p0, Lcom/opongo/android/custom/DealsActivity;->receiverPush:Landroid/content/BroadcastReceiver;

    invoke-virtual {p0, v0}, Lcom/opongo/android/custom/DealsActivity;->unregisterReceiver(Landroid/content/BroadcastReceiver;)V

    .line 78
    iget-object v0, p0, Lcom/opongo/android/custom/DealsActivity;->dbManager:Lcom/opongo/blogapp/manager/DatabaseManager;

    invoke-virtual {v0}, Lcom/opongo/blogapp/manager/DatabaseManager;->close()V

    .line 79
    invoke-super {p0}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onDestroy()V

    .line 80
    return-void
.end method

.method public onOptionsItemSelected(Landroid/view/MenuItem;)Z
    .locals 2
    .parameter "item"

    .prologue
    .line 84
    invoke-super {p0, p1}, Lcom/opongo/blogapp/activities/AbstractViewPagerActivity;->onOptionsItemSelected(Landroid/view/MenuItem;)Z

    .line 86
    invoke-interface {p1}, Landroid/view/MenuItem;->getItemId()I

    move-result v1

    packed-switch v1, :pswitch_data_0

    .line 92
    const/4 v1, 0x0

    :goto_0
    return v1

    .line 88
    :pswitch_0
    sget-object v0, Lcom/opongo/android/custom/DealsActivity;->ADAPTER:Landroid/support/v4/view/PagerAdapter;

    check-cast v0, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;

    .line 89
    .local v0, adapter:Lcom/opongo/blogapp/adapter/ViewPagerAdapter;
    invoke-virtual {v0}, Lcom/opongo/blogapp/adapter/ViewPagerAdapter;->doRefreshAll()V

    .line 90
    const/4 v1, 0x1

    goto :goto_0

    .line 86
    nop

    :pswitch_data_0
    .packed-switch 0x7f080060
        :pswitch_0
    .end packed-switch
.end method
